
<%@page contentType="text/html" pageEncoding="UTF-8" import="java.util.List,
        java.util.ArrayList,
        gandalf.model.*,
        gandalf.controller.*"
        %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
        <link rel="stylesheet" href="css/style.css" type="text/css" media="screen, projection">
        <link rel="stylesheet" href="blueprint/src/forms.css" type="text/css" media="screen, projection">
        <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
        <script type="text/javascript" src="javascript/script.js"></script>
    </head>
    <%
                    //DogodekDao dogodekDao = new DogodekDao();
                    //CartJpaController cartDao = new CartJpaController();
                    StrankaJpaController strankaDao = new StrankaJpaController();
                    RezervacijaJpaController rezervacijaDao = new RezervacijaJpaController();

                    Long idStranke = (Long) request.getSession().getAttribute("stranka_id");

                    Stranka stranka = null;
                    if (idStranke != null) {
                        stranka = strankaDao.findStrankaWithNakupi(idStranke);
                    }
        %>
    <body>
         <div id="header">
            <h1 id="logo">Gandalf</h1>
            <ul id="nav">
                <li><a href="index.jsp">Dogodki</a></li>
                <li><a href="mailto:gandalf_support@gmail.com">Kontakt</a></li>
                <li><a href="<%= stranka != null ? "logout.jsp" : "login.jsp"%>">
                        <%= stranka != null ? "Odjava" : "Prijava"%></a></li>
            </ul>
        </div><!-- header -->
        <div id="section" class="container">
        

          
        <h3><%= stranka.getIme() + " " + stranka.getPriimek() %></h3>
        <p><%= stranka.getNaslov() + " " + stranka.getKraj() %></p>
        <p><%= stranka.getEmail() %></p>
        <p> Naročen: <%=stranka.isNarocen()%></p>
            
        <p><a href="urediProfil.jsp" class="Prijavljen">Uredi profil</a></p>

        <h2>Nakupi</h2>
        <ul>
            <% for(Nakup n : stranka.getNakupi()) { %>
            <li>Datum:<%= " " + n.getDatumPlacila() + " | " + n.getOpis() + " | Način plačina: " + n.getNacinPlacila() %></li>
            <% }%>
        </ul>
        <h2>Rezervacije</h2>
        <ul>
            <% for(Rezervacija r : rezervacijaDao.findRezervacijaWithStranka(idStranke)) { %>
            <li><%= " " + r.getId() + " | " + r.getDatum() + " | Rezervirane vstopnice: "%>
            <%for(Postavka p : r.getPostavka()){%><%=p.getVstopnica().getNaziv() +
            " "+ p.getVstopnica().getVrsta() +" ("+ p.getKolicina() + ")  |  "%><%}%></li>
            <% }%>
        </ul>
        </div>
    </body>
</html>
